package service.impl;

import dao.StaffInfoDao;
import dao.impl.StaffInfoDaoImpl;
import entity.StaffInfo;
import service.StaffInfoService;

import javax.swing.*;
import java.util.List;

/**
 * @author gwf
 * @date 2025-02-24
 */
public class StaffInfoServiceImpl implements StaffInfoService {
    private StaffInfoDao dao = new StaffInfoDaoImpl();
    @Override
    public List<StaffInfo> all() {
        try {
            return dao.list();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int delete(int id) {
        try {
            return dao.del(id);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int update(StaffInfo staffInfo) {
        try {
            return dao.modify(staffInfo);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public int add(StaffInfo staffInfo) {
        try {
            return dao.add(staffInfo);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }


}
